var name = 'world';
// 自执行函数会形成词法作用域，拿不到外围的值
(function() {
    console.log(name);
    if(typeof name ==='undefined') {
        var name = 'Friend';
        console.log('goodbye'+name);  
    }else {
        console.log('heelo'+name);
    }
})();